package com.futureCloudMOM.core.domain;

import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableName;
import com.futureCloudMOM.common.constant.GenConstants;
import com.futureCloudMOM.core.entity.FBaseEntity;
import io.swagger.annotations.ApiModel;
import io.swagger.annotations.ApiModelProperty;
import lombok.Data;
import lombok.EqualsAndHashCode;
import org.hibernate.validator.constraints.Length;
import org.springframework.beans.BeanUtils;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.io.Serializable;

@Data
@EqualsAndHashCode(callSuper = true)
@ApiModel(value = "Produce_TaskBillRoutingProcess", description = "生产订单工艺工序表")
@TableName(value = "Produce_TaskBillRoutingProcess")
public class ProduceTaskBillRoutingProcess extends FBaseEntity implements Serializable {



    @NotNull(message="[生产订单单据id]不能为空")
    @ApiModelProperty("生产订单单据id")
    @TableField(value = "taskBillRoutingID")
    private Long taskBillRoutingID;

    @NotNull(message="[工序序号]不能为空")
    @ApiModelProperty("工序序号")
    @TableField(value = "subNo")
    private Long subNo;

    @NotNull(message="[工序ID]不能为空")
    @ApiModelProperty("工序ID")
    @TableField(value = "processId")
    private Long processId;

    @ApiModelProperty("工作中心ID")
    @TableField(value = "workCenterId")
    private Long workCenterId;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("提前投入时间")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "leadTime")
    private String leadTime;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("标准工时")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "stdTime")
    private String stdTime;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("备注")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "remark")
    private String remark;

    @ApiModelProperty("下道工序id")
    @TableField(value = "nextProcId")
    private Long nextProcId;

    @NotNull(message="[是否计算准备时间]不能为空")
    @ApiModelProperty("是否计算准备时间")
    @TableField(value = "checkFlag")
    private Long checkFlag;

    @ApiModelProperty("上道工序Id")
    @TableField(value = "parentProcId")
    private Long parentProcId;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("需求数量")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "qty")
    private String qty;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("加工工价")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "stdPrice")
    private String stdPrice;

    @Size(max= 500,message="编码长度不能超过500")
    @ApiModelProperty("工单工序备注附加文件")
    @Length(max= 500,message="编码长度不能超过500")
    @TableField(value = "attachFiles")
    private String attachFiles;

    @NotNull(message="[是否使用模具/工装]不能为空")
    @ApiModelProperty("是否使用模具/工装")
    @TableField(value = "useMould")
    private Integer useMould;

    /**
     * 根据工艺工序复制出订单工序实例
     *
     * @param process 工艺工序实例
     * @return 订单工序实例
     */
    public static ProduceTaskBillRoutingProcess getInstance(BasicRoutingProcess process) {
        ProduceTaskBillRoutingProcess taskBillRoutingProcess = new ProduceTaskBillRoutingProcess();
        BeanUtils.copyProperties(process, taskBillRoutingProcess, GenConstants.F_BASE_ENTITY);
        return taskBillRoutingProcess;
    }

}

